class JPaginationLinkRenderer < WillPaginate::ViewHelpers::LinkRenderer

  def prepare(collection, options, template)
    super
    @options[:container] = false
  end

  protected

    def pagination
      items = (1..total_pages).to_a
      items.unshift(:previous_page) if @collection.previous_page
      items.push(:next_page) if @collection.next_page
      items
    end

    def page_number(page)
      tag(:li, link(tag(:b, page), page, :title => "Page #{page}", :class => page == current_page ? "current" : nil))
    end

    def previous_page
      tag(:li, link([ @template.image_tag("icons/fugue/navigation-180.png", :size => "16x16"), "Prev" ].join(" "), @collection.previous_page, :title => "Previous"))
    end

    def next_page
      tag(:li, link([ "Next", @template.image_tag("icons/fugue/navigation.png", :size => "16x16") ].join(" "), @collection.next_page, :title => "Next"))
    end

end